package com.yixing.tech.wcs.util;

import com.alibaba.fastjson.JSONObject;
import com.yixing.tech.common.base.BusinessException;
import com.yixing.tech.common.vo.s3.UserVO;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class UserUtil {

    @Resource
    StringRedisTemplate stringRedisTemplate;

    public UserVO getLoginUser(String token) throws BusinessException {
        String json = stringRedisTemplate.opsForValue().get("user.token:" + token);
        return JSONObject.parseObject(json, UserVO.class);
    }
}
